package com.jbinfo.qingcaowan.user.service;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jbinfo.qingcaowan.user.dao.OrgDao;

/**
 * 
* @ClassName: OrgServiceImpl 
* @Description: TODO 组织管理service实现类
* @author ZhangLei 
* @date 2016年6月22日 上午10:23:02
 */
@Service("orgService")
public class OrgServiceImpl implements OrgService {

	@Resource(name="orgDao")
	private OrgDao orgDao;
	
	
	// 根据orgId 获取所有parentOrgId
	@Override
	public String getParentOrgId(String orgId) {
		
		String parentOrgId = orgDao.selectParentOrgId(orgId);
		
		String pOrgId = "";
		if (parentOrgId != null && !parentOrgId.isEmpty()) {
			if (pOrgId != null && !pOrgId.isEmpty()) {
				pOrgId += ",";
			}
			pOrgId += parentOrgId;
			
			parentOrgId = getParentOrgId(parentOrgId);
			
		}
		
		return pOrgId;
	}

}
